namespace MsForgeReboot.Services.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class NewCriesNoCryStatistics : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.CryStatistics", "Cry_Id", "dbo.Cries");
            DropIndex("dbo.CryStatistics", new[] { "Cry_Id" });
            AddColumn("dbo.Cries", "Name", c => c.String());
            AddColumn("dbo.Cries", "Channel", c => c.Binary());
            AddColumn("dbo.Cries", "Status", c => c.Int(nullable: false));
            DropColumn("dbo.Events", "Discriminator");
            DropColumn("dbo.Cries", "Title");
            DropColumn("dbo.Cries", "FullText");
            DropColumn("dbo.Cries", "StartDate");
            DropColumn("dbo.Cries", "EndDate");
            DropColumn("dbo.Cries", "Address");
            DropTable("dbo.CryStatistics");
        }
        
        public override void Down()
        {
            CreateTable(
                "dbo.CryStatistics",
                c => new
                    {
                        Id = c.Int(nullable: false, identity: true),
                        Channel = c.String(),
                        Delivered = c.Boolean(nullable: false),
                        DateDelivered = c.DateTime(nullable: false),
                        DeliveryStatus = c.Int(nullable: false),
                        Cry_Id = c.Int(),
                    })
                .PrimaryKey(t => t.Id);
            
            AddColumn("dbo.Cries", "Address", c => c.String());
            AddColumn("dbo.Cries", "EndDate", c => c.DateTime());
            AddColumn("dbo.Cries", "StartDate", c => c.DateTime());
            AddColumn("dbo.Cries", "FullText", c => c.String());
            AddColumn("dbo.Cries", "Title", c => c.String());
            AddColumn("dbo.Events", "Discriminator", c => c.String(nullable: false, maxLength: 128));
            DropColumn("dbo.Cries", "Status");
            DropColumn("dbo.Cries", "Channel");
            DropColumn("dbo.Cries", "Name");
            CreateIndex("dbo.CryStatistics", "Cry_Id");
            AddForeignKey("dbo.CryStatistics", "Cry_Id", "dbo.Cries", "Id");
        }
    }
}
